//
//  YYJLLoginViewController.m
//  YuanyangJinlou
//
//  Created by mac004 on 2016/12/27.
//  Copyright © 2016年 suli19910309@qq.com. All rights reserved.
//

#import "YYJLLoginViewController.h"
#import "YYJLForgetViewController.h"
#import "ViewController.h"
@interface YYJLLoginViewController ()
{
    UIView   * _bgView;//背景底图
    UIImageView *_logoImgView;//logo图标
    UITextField * _accountTF;//账户名
    UITextField * _passwordTF;//密码
    UIButton    * _loginBtn;//登录按钮
    UIButton    * _forgetBtn;//忘记密码
    UIImageView * _downImgView;//底部view
}
@end

@implementation YYJLLoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
 //   [self.navigationController setNavigationBarHidden:YES animated:YES];
       [self creatUI];
    
    [self setTitleView:@"登录" ];

    
    
}
-(void)creatUI
{
   
    _bgView=[[UIView alloc ]initWithFrame:CGRectMake(12*PER_WIDTH,74*PER_HEIGHT ,351*PER_WIDTH,432*PER_HEIGHT)];
    _bgView.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:_bgView];
    //logo
    _logoImgView=[MyControl createImageViewWithFrame:CGRectMake(116*PER_WIDTH, 20*PER_HEIGHT, 120*PER_WIDTH, 107*PER_HEIGHT) ImageName:@"logo"];
    [_bgView addSubview:_logoImgView];
    //账号
    UIImage*leftImg=[UIImage imageNamed:@"ico_zhanghao"];
    UIImageView*leftView=[[UIImageView alloc]initWithFrame:CGRectMake(0*PER_WIDTH, 11*PER_HEIGHT, leftImg.size.width*PER_WIDTH, leftImg.size.height*PER_HEIGHT)];
    leftView.image=leftImg;
    _accountTF=[MyControl createTextFieldWithFrame:CGRectMake(18*PER_WIDTH,_logoImgView.bottom+50*PER_HEIGHT ,315*PER_WIDTH, 40*PER_HEIGHT) placeholder:@"请输入账号" passWord:NO leftImageView:leftView rightImageView:nil];
    
    [_bgView addSubview:_accountTF];
    //密码
      UIImage*leftImg1=[UIImage imageNamed:@"password"];
    UIImageView*leftView1=[[UIImageView alloc]initWithFrame:CGRectMake(11*PER_WIDTH, 11*PER_HEIGHT, leftImg1.size.width*PER_WIDTH, leftImg1.size.height*PER_HEIGHT)];
    leftView1.image=leftImg1;
    _passwordTF=[MyControl createTextFieldWithFrame:CGRectMake(_accountTF.left, _accountTF.bottom+15*PER_HEIGHT, 315*PER_WIDTH, 40*PER_HEIGHT) placeholder:@"请输入密码" passWord:YES leftImageView:leftView1 rightImageView:nil];
    [_bgView addSubview:_passwordTF];
    
    
    //登录按钮
    _loginBtn=[MyControl createButtonWithFrame:CGRectMake(_accountTF.left, _passwordTF.bottom+70*PER_HEIGHT ,315*PER_WIDTH, 40*PER_HEIGHT) ImageName:@"" Target:self Action:@selector(login) Title:@"登录"];
    _loginBtn.layer.cornerRadius=8;
    _loginBtn.backgroundColor=UIColorFromHex(0xbc0c16);
    _loginBtn.titleLabel.font=[UIFont fontWithName:HSGBW3 size:36*PER_WIDTH];
    [_bgView addSubview:_loginBtn];
    
    //底部背景
    UIImage*bottomLogoImg=[UIImage imageNamed:@"bg_login"];
   
    _downImgView=[[UIImageView alloc]initWithFrame:CGRectMake(0, self.view.bottom-bottomLogoImg.size.height*PER_HEIGHT, self.view.width, bottomLogoImg.size.height*PER_HEIGHT)];
    _downImgView.image=bottomLogoImg;
    [self.view addSubview:_downImgView];
    //忘记密码
    UILabel*forgetLabel=[MyControl createLabelWithFrame:CGRectZero Font:14 Text:@"忘记密码"];
    float width=[forgetLabel.text boundingRectWithSize:CGSizeMake(1000, 20) options:0|1 attributes:@{NSFontAttributeName:forgetLabel.font} context:nil].size.width ;
    forgetLabel.frame=CGRectMake(_passwordTF.right-width*PER_WIDTH, _passwordTF.bottom+10*PER_HEIGHT, width*PER_WIDTH, 14*PER_HEIGHT);
    forgetLabel.textColor=UIColorFromHex(0x999999);
    UITapGestureRecognizer*tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tap)];
    forgetLabel.userInteractionEnabled=YES;
    [forgetLabel addGestureRecognizer:tap];
    [_bgView addSubview:forgetLabel];

    UIImage*wenhao=[UIImage imageNamed:@"ico_tishi"];
    
    UIImageView*wenhaoImg=[[UIImageView alloc]initWithFrame:CGRectMake(forgetLabel.left-5*PER_WIDTH- wenhao.size.width*PER_WIDTH, forgetLabel.top, wenhao.size.width*PER_WIDTH, wenhao.size.height*PER_HEIGHT)];
    wenhaoImg.image=wenhao;
    [_bgView addSubview:wenhaoImg];
    
    
    UILabel*markLabel=[[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH-310*PER_WIDTH,bottomLogoImg.size.height-43*PER_HEIGHT,296*PER_WIDTH,14*PER_HEIGHT)];
    markLabel.font=[UIFont fontWithName:@"SimHei" size:14.*PER_WIDTH];
    markLabel.textAlignment=NSTextAlignmentRight;
    markLabel.textColor=UIColorFromHex(0xffffff);
    markLabel.text=@"最专业的珠宝培训基地-商学院";
    [_downImgView addSubview:markLabel];
    
}
//登录
-(void)login{
    
   }
//忘记密码
-(void)tap{
    NSLog(@"点击");
   YYJLForgetViewController *forget=[[YYJLForgetViewController alloc]init];
    
    [self.navigationController pushViewController:forget animated:YES];

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
